Skip to content

feat(query-bar): Filter chip component: validation, keyboard interactions, and overflow behavior [AS-638]#37

Closed
pigarevaoks wants to merge 21 commits intomainfrom
feature/filter-attacks-components-oks
Closed

feat(query-bar): Filter chip component: validation, keyboard interactions, and overflow behavior [AS-638]#37
pigarevaoks wants to merge 21 commits intomainfrom
feature/filter-attacks-components-oks

Conversation

@pigarevaoks
Copy link
Collaborator

Summary

  • Add operator symbol Kbd badges and type-specific labels to the operator menu (e.g. string: "is", "like"; date: "after", "on or after")
  • Support options: string[] shorthand on FieldMetadata for simple value lists
  • Support options: [] for freeform custom value input (no dropdown, Space/Enter commits)
  • Set operator menu width to 256px

Test plan

  • Verify operator menu shows correct labels per field type (string, integer, date, boolean, enum)
  • Verify Kbd symbol badges appear for all types except boolean
  • Verify options: ['GET', 'POST', ...] renders value dropdown correctly
  • Verify options: [] (freeform) skips value dropdown, Enter/Space creates chip
  • Run pnpm --filter design-system exec tsc --noEmit — no errors
  • Run pnpm --filter design-system test — all tests pass

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

This PR is included in version 0.10.0-rc-feature-filter-attacks-components-oks.1

@pigarevaoks pigarevaoks changed the title feat(query-bar): add operator symbols, type labels, and freeform value input feat(query-bar): Filter chip component: validation, keyboard interactions, and overflow behavior [AS-638] Mar 12, 2026
@github-actions
Copy link
Contributor

This PR is included in version 0.10.0-rc-feature-filter-attacks-components-oks.2

pigarevaoks and others added 16 commits March 13, 2026 16:09
Complete implementation of the QueryBar component for building filter expressions:

- Progressive chip building flow: field → operator → value
- Inline segment editing (click attribute/operator/value to edit in-place)
- Multi-select value editing with dropdown checkboxes
- AND/OR logical connectors between conditions
- Date field support with calendar picker and range selection
- Keyboard navigation (ArrowUp/Down, Enter, Escape, ArrowRight, Cmd+Arrow multi-select)
- Fuzzy sort for field and value dropdown menus
- Insertion gaps for adding conditions between existing chips
- Error validation for unknown fields and invalid values
- Comprehensive E2E and unit tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…av and chip editing

- Remove duplicate WithFooter story in DropdownMenu
- Improve keyboard navigation in QueryBar menus
- Fix chip editing flow and value menu state handling
- Update QueryBar e2e tests
- Clean up index exports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rator menu

- Update OPERATOR_LABELS_BY_TYPE for all field types (string, integer, float, date)
- Add operator symbol Kbd badges to operator menu items (hidden for boolean)
- Support custom operators list from FieldMetadata via operators prop
- Set operator menu width to 256px per Figma spec

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Support `options: string[]` on FieldMetadata as shorthand for simple
values and `options: []` for freeform custom value input. Space key
also commits freeform values (same as Enter).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ning and menu flow

- Enforce single-dropdown constraint: connector chip and autocomplete
  menu cannot be open simultaneously
- Decompose useQueryBarAutocomplete into focused sub-hooks:
  useFocusManagement, useInputHandlers, valueCommitHelpers
- Fix dropdown Y-axis and X-axis positioning when inserting between chips
- Use flushSync for menu repositioning on gap clicks and chip completion
- Add continueBuilding parameter to resetState to prevent unwanted menu opens
- Fix deriveAutocompleteValues to use getFieldValues instead of raw values
- Memoize operatorGroups, extract constants, simplify value commit logic
- Add building chip wrapper with border styling and inline input

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract buildContainerAnchoredRect utility and useQueryBarPositioning
hook to unify dropdown positioning across ConnectorChip and autocomplete
menus. Both now anchor vertically to the query bar container edge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Highlight errors on specific chip segments (attribute or value) instead
of the whole chip. For multi-value chips, only invalid values are red.

- Add ChipErrorSegment discriminated type ('attribute' | 'value' | boolean)
- Extract ValueSegment component for multi-value per-value error coloring
- Use CVA compoundVariants to avoid Tailwind class conflicts
- Extract shared isValidFieldValue/getInvalidValueIndices helpers
- Pass valueParts array to avoid fragile comma-split on display strings
- Fix connector chip open state flash during menu transitions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Display a destructive Alert under the QueryBar input listing all
filter validation errors (unknown fields, invalid values).

- Add QueryBarErrors component using Alert compound components
- Add parseQueryBarErrors pure function for error message generation
- Reuse isValidFieldValue/getFieldValues shared helpers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… blur

Separate display text from dropdown filter text so editing a chip segment
shows all options until the user types. Add blurCommitRef pattern so
clicking outside a multi-select dropdown commits checked values instead
of discarding them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Collapse chip area to 3 visible rows with overflow scroll
- Add Expand (Maximize2) / Collapse (Minimize2) buttons with tooltips
- Auto-collapse when chips are removed and content fits
- Position action buttons absolutely so chips span full width
- Add thin native scrollbar styled to match ScrollArea thumb color
- Extract useExpandCollapse hook and decompose height constants

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… to folders

- Extract resetSegmentState, removeConnectorAtConditionIndex, findMatchingFieldValue,
  getEditingCondition helpers to reduce duplication
- Extract CONNECTOR_ID_PATTERN, QUERY_BAR_SELECTOR into shared lib/constants
- Extract useChipsSplitting hook from QueryBarInput
- Move hooks into dedicated hooks/ directories (QueryBarInput, QueryBarMenu)
- Remove single quotes from error messages in parseQueryBarErrors
- Add clarifying comment for flushSync close→reopen pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix useConsistentBuiltinInstantiation: Array() → new Array()
- Add missing dateRange dependency in useQueryBarAutocomplete resetState
- Add biome-ignore for intentional dependency omissions in Segment,
  QueryBarDateValueMenu, useValueMenuState, useKeyboardNav

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace biome-ignore suppressions with proper fixes:
- Segment: use children/editText as fallback values
- DateValueMenu: remove showCalendar read, simplify else
- useValueMenuState: stabilize commitChecked with useCallback,
  use ref guard for serialized comparison
- useKeyboardNav: add handleModArrow and menuRef to deps
- QueryBar stories: add w-[800px] decorator

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pigarevaoks pigarevaoks force-pushed the feature/filter-attacks-components-oks branch from a4d016b to 9d64329 Compare March 13, 2026 15:09
pigarevaoks and others added 5 commits March 13, 2026 16:45
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change error parameter type from boolean to ChipErrorSegment
to match the actual signature in useQueryBarExpression.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant